package com.yxt.qmgf.home.view;

import com.yxt.qmgf.home.ctrl.AboutPageController;
import com.yxt.qmgf.home.dao.gonggaoDao;
import com.yxt.qmgf.home.service.impl.gonggaoServiceImpl;
import javafx.fxml.FXMLLoader;
import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.control.Tab;
import javafx.scene.layout.Pane;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.net.URL;


public class AboutTab extends Tab {
    private static volatile AboutTab instance;


    private AboutTab() {
        this("关于");
    }

    private AboutTab(String str) {
        super(str);
        initView();
    }

    public static AboutTab getInstance() {
        if (null == instance) {
            synchronized (AboutTab.class) {
                if (null == instance) {
                    instance = new AboutTab();
                }
            }
        }
        return instance;
    }

    private void initView() {
        URL url = getClass().getResource("/fxml/home/aboutPage.fxml");
        FXMLLoader fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(url);
        fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
        try {
            Pane imageView = fxmlLoader.load();
            setContent(imageView);
        } catch (IOException e) {
            e.printStackTrace();
        }
        setClosable(true);
    }
}